BigDFT.LRTDDFT module

transition_indexes(np, nalpha, indexes)[source]

Returns the list of the indices in the bigdft convention that correspond to the couple iorb-ialpha with given spin.

Parameters:
  • np (tuple) – (norbu,norbd) occupied orbitals: when of length 1 assumed spin averaged

  • nalpha (tuple) – (norbu, norbd)virtual orbitals: when of length 1 assumed spin averaged

  • indexes (list) – list of tuples of (iorb,ialpha,ispin) desired indices in python convention (start from 0)

class TransitionMatrix(matrix=None, norb_occ=None, norb_virt=None, log=None)[source]

Matrix of Transition Quantities, might be either CouplingMatrix or TransitionMultipoles

Parameters:
  • matrix (matrix-like) – data of the coupling matrix. If present also the number of orbitals should be provided.

  • norb_occ (tuple) – number of occupied orbitals per spin channnel. Compulsory if matrix is specified.

  • norb_virt (tuple) – number of empty orbitals per spin channnel. Compulsory if matrix is specified.

  • log (Logfile) – Instance of the logfile from which the coupling matrix calculation is performed. Automatically retrieves the norb_occ and norb_virt` parameters. When log parameter is present the parameter matrix is ignored.

Raises:

ValueError – if the file of the coupling matrix indicated by log does not exists

class CouplingMatrix(matrix=None, norb_occ=None, norb_virt=None, log=None)[source]

Casida Coupling Matrix, extracted from the calculation performed by BigDFT

subportion(norb_occ, norb_virt)[source]

Extract a subportion of the coupling matrix.

Returns a Coupling Matrix which is made by only considering the first norb_occ and norb_virt orbitals

Parameters:
  • norb_occ (tuple) – new number of occupied orbitals. Must be lower that the instance value

  • norb_virt (tuple) – new number of virtual orbitals. Must be lower that the instance value

diagonalize()[source]

Diagonalize the Coupling Matrix

Returns:

tuple of the Eigenvvalues and Eigenvectors of the coupling matrix,

as returned by numpy.linalg.eigh(). We perform the transpose of the matrix with eigenvectors to have them sorted as row vectors

Return type:

(np.matrix, np.matrix)

class TransitionMultipoles(matrix=None, norb_occ=None, norb_virt=None, log=None)[source]

Transition dipoles, extracted from the calculation performed by BigDFT

subportion(norb_occ, norb_virt)[source]

Extract a subportion of the Transition Multipoles.

Returns a set of transition multipoles which is made by only considering the first norb_occ and norb_virt orbitals

Parameters:
  • norb_occ (tuple) – new number of occupied orbitals. Must be lower that the instance value

  • norb_virt (tuple) – new number of virtual orbitals. Must be lower that the instance value

Returns:

reduced transition multipoles

Return type:

TransitionMultipoles

get_transitions()[source]

Get the transition quantities as the dimensional objects which should contribute to the oscillator strengths.

Returns:

Transition quantities multiplied by the square root of the unperturbed transition energy

Return type:

numpy.array

class TransitionDipoles(matrix=None, norb_occ=None, norb_virt=None, log=None)[source]

Transition dipoles as provided in the version of the code < 1.8.0. Deprecated, to be used in some particular cases

class Excitations(cm, tm)[source]

LR Excited states of a system

Definition of the excited states in the Casida Formalism

Parameters:
spectrum_curves(omega, slice=None, weights=None)[source]

Calculate spectrum curves.

Provide the set of the curves associated to the weights. The resulting curves might then be used to draw the excitation spectra.

Parameters:
  • omega (array) – the linspace used for the plotting, of shape (n,). Must be provided in Atomic Units

  • slice (array) – the lookup array that has to be considered. if Not provided the entire range is assumed

  • weights (array) – the set of arrays used to weight the spectra. Must have shape (rank,m), where rank is equal to the number of eigenvalues. If m is absent it is assumed to be 1. When not specified, it defaults to the average oscillator strenghts.

Returns:

a set of spectrum curves, of shape equal to (n,m), where n is the shape of omega and m the size of the second dimension of weights.

Return type:

array

identify_singlet_and_triplets(tol=1e-05)[source]
Find the lookup tables that select the singlets and the triplets among

the excitations

Parameters:

tol (float) – tolerance to be applied to recognise the spin character

project_on_spin(exc, tol=1e-08)[source]

Control if an excitation has a Singlet or Triplet character

Parameters:

exc (int) – index of the excitation to be controlled

Returns:

couple of booleans indicating if the excitation is a singlet or a triplet respectively

Return type:

tuple (bool,bool)

split_excitations(evals, tol, nexc='all')[source]

Separate the excitations in channels.

This methods classify the excitations according to the channel they belong, and determine if a given excitation might be considered as a belonging to a discrete part of the spectrum or not.

Parameters:
  • evals (BandArray) – the eigenvalues as they are provided (for instance) from a Logfile class instance.

  • tol (float) – tolerance for determining the threshold

  • nexc (int,str) – number of excitations to be analyzed. If 'all' then the entire set of excitations are analyzed.

identify_thresholds(occ_energies, tol, nexc)[source]

Identify the thresholds per excitation.

For each of the first nexc excitations, identify the energy value of its corresponding threshold. This value is determined by projecting the excitation components on the occupied states and verifying that their norm for the highest energy level is below a given tolerance.

Parameters:
  • occ_energies (tuple of array-like) – contains the list of the energies of the occupied states per spin channel

  • tol (float) – tolerance for determining the threshold

  • nexc (int) – number of excitations to be analyzed

determine_occ_energies(evals)[source]

Extract the occupied energy levels from a Logfile BandArray structure, provided the tuple of the number of occupied states

Parameters:

evals (BandArray) – the eigenvalues as they are provided (for instance) from a Logfile class instance.

plot_alpha(**kwargs)[source]

Plot the imaginary part.

Plot the real or imaginary part of the dynamical polarizability.

Keyword Arguments:
  • real (bool) – True if real part has to be plotted. The imaginary part is plotted otherwise

  • eta (float) – Value of the complex imaginary part. Defaults to 1.e-2.

  • group (str) – see lookup()

  • **kwargs – other arguments that might be passed to the plot() method of the matplotlib.pyplot module.

Returns:

the reference to matplotlib.pyplot module.

Return type:

matplotlib.pyplot

lookup(group)[source]

Identify the group of the excitations according to the argument

Parameters:

group (str) –

A string chosen between

  • "all" : provides the entire set of excitations (None instead of the lookup array)

  • "bt" : provides only the excitations below threshold

  • "at" : provides only the excitations above threshold

  • "singlets" : provides the index of the excitations that have a singlet character

  • "triplets" : provides the index of the excitations that have a triplet character

plot_excitation_landscape(**kwargs)[source]

Represent the excitation landscape as splitted in the excitations class

Parameters:

**kwargs – keyword arguments to be passed to the pyplot instance. The xlabel, ylabel as well as xlim are already set.

Returns:

the reference to matplotlib.pyplot

module.

Return type:

matplotlib.pyplot

Example

>>> ex=Excitations(cm,tm)
>>> ex.split_excitations(evals=...,tol=1.e-4,nexc=...)
>>> ex.plot_excitation_landscape(title='Excitation landscape')
dos_dict(group='all')[source]

Dictionary for DoS creation.

Creates the keyword arguments that have to be passed to the meth:BigDFT.DoS.append method of the DoS class

Parameters:

group (str) – see lookup()

Returns:

kewyord arguments that can be passed to the meth:BigDFT.DoS.append method of the DoS.DoS class

Return type:

dict

dos(group='all', **kwargs)[source]

Density of States of the Excitations.

Provides an instance of the DoS class, corresponding to the Excitations instance.

Parameters:
  • group (str) – see lookup()

  • **kwargs – other arguments that might be passed to the DoS.DoS instantiation

Returns:

instance of the Density of States class

Return type:

DoS.DoS

plot_Sminustwo(coord, alpha_ref=None, group='all')[source]

Inspect S-2 sum rule.

Provides an handle to the plotting of the $S^{-2}$ sum rule, which should provide reference values for the static polarizability tensor.

Parameters:
  • coord (str) – the coordinate used for inspection. May be 'x', 'y' or 'z'.

  • alpha_ref (list) – diagonal of the reference static polarizability tensor (for instance calculated via finite differences). If present the repartition of the contribution of the various groups of excitations is plotted.

  • group (str) – see lookup()

Returns:

reference to matplotlib.pyplot module.